﻿@using ECG.Utility
@model IEnumerable<ECG.Common.ProductCategoryDto>

@if (Model.Any())
{
    <ul class="cate-list-l1">
        @{
            //--Luon hien thi cac danh muc thuoc danh muc cha tren cung
            var childMenuList = Model.Where(m => m.ParentId == "0").OrderBy(m => m.Ordering);
            foreach (var item in childMenuList)
            {
                var menuListSameLevel = Model.Where(m => m.ParentId == item.Id).OrderBy(m => m.Ordering);
                <li class="cate-list-idot">
                    <a href="@Url.Action("Index", "CategoryL1", new {categoryName = StringUtil.RemoveSpecialCharactersVn(item.Name), categoryId = item.Id})" class="lnk-cate-l2" title="@item.Name">
                        <h2>@item.Name</h2>
                    </a>
                    @foreach (var item2 in menuListSameLevel)
                    {
                        <a href="@Url.Action("Index", "Category", new {categoryName = StringUtil.RemoveSpecialCharactersVn(item2.Name), categoryId = item2.Id})" class="lnk-cate-l3" title="@item2.Name">
                            <h3>@item2.Name</h3>
                        </a>
                    }

                </li>
            }
        }
    
    </ul>
}
@*@if(parent.Any())
{
    <div class="bb_cateListSub">
        <div class="babo-icon-category bb_c_l_header">
            <span class="bb_c_title1">DANH MỤC<br/></span>
            <span class="bb_c_title2">TÌM KIẾM</span>
        </div>
        <div class="bb_c_l_category">
            <span class="bb_c_t_all">TOÀN BỘ
                <span class="bb_c_t_smalltxt">(2013)</span>
            </span>
            <ul class="bb_c_Listsub">
                @foreach(var item in parent)
                {
                    var children = (from c in Model where c.ParentId == item.Id select c).ToList();
                    <li>
                        <a href="javascript:void(0);" title="@item.Name" class="bb_c_l1"><h2>@item.Name</h2></a>
                        @if(children.Any())
                        {
                            <div class="bb_c_l2">
                                @foreach(var child in children)
                                {
                                    <a href="@Url.Action(ViewBag.Action, ViewBag.Controler, new { CategoryName = StringUtil.RemoveSpecialCharactersVn(child.Name), CategoryId = child.Id })" title="@child.Name" class="@string.Format("cate-{0}", child.Id) bb_c_l1"><h2>@child.Name</h2></a>
                                }
                            </div>
                        }
                    </li>
                }
            </ul>                  
        </div>
    </div>
}*@
